package com.example.demothree.common;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private MyInterceptor corsConfig;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //此处 addPathPatterns()方法指的是拦截的规则
        // ("/**")指的是拦截所有  后续的excludePathPatterns()方法指的是排除的，
        //不触发拦截的请求或者静态资源
        registry.addInterceptor(corsConfig).addPathPatterns("/**")
                .excludePathPatterns("/login/addyh", "/login.html","/layui/**","/js/**","/lyear/**","/pages/**","/static/**","/","/login/login");

    }

}
